<template>
    <div>
        <van-tabs v-model="active">
            <van-tab title="页面列表"></van-tab>
            <van-tab title="新页面"></van-tab>
        </van-tabs>
        <router-view></router-view>
    </div>
</template>

<script>
export default {
    name: "PageLayout",
    data: () => ({
        active: 0,
        tabs: [
            '/wap/page/pages',
            '/wap/page/new'
        ]
    }),
    mounted() {
        this.active = this.tabs.indexOf(this.$route.path)
    },
    watch: {
        active(v, oldv) {
            const route = this.tabs[v]
            if (this.$route.path != route) {
                this.$router.replace(route)
            }
        }
    }
}
</script>

<style scoped>

</style>
